package com.codelabs.basicstatecodelab

import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.Modifier

/**
 * 包含饮水计数器和健康任务列表
 *
 * @author owner
 * @date 2024/3/18 14:24
 */

@Composable
fun WellnessScreen(modifier: Modifier = Modifier) {
//    WaterCounter(modifier)
    Column(modifier = modifier) {
        StatefulCounter(modifier)
        val list = remember{ getWellnessTask().toMutableStateList() }
        WellnessTaskList(list = list, onCloseTask = { task -> list.remove(task) } )
    }
}

fun getWellnessTask() = List(30) { i -> WellnessTask(i, "Task # $i") }